//
//  LRXGetTime.m
//  路人侠
//
//  Created by zhangxulong on 16/3/9.
//  Copyright © 2016年 zhangxulong. All rights reserved.
//

#import "LRXGetTime.h"

@implementation LRXGetTime

+ (NSDateComponents * )initTime
{
    // 1.获得年月日
    NSCalendar * calendar = [NSCalendar currentCalendar];
    NSUInteger unitFlags = NSCalendarUnitYear| NSCalendarUnitMonth | NSCalendarUnitDay |NSCalendarUnitHour |NSCalendarUnitMinute;
    
    NSDateComponents * cmp = [calendar components:unitFlags fromDate:[NSDate date]];
    
    return cmp;
}
+ (NSInteger)getMinute
{
    return [[LRXGetTime initTime] minute];
}


+ (NSInteger)getSecond
{
    return [[LRXGetTime initTime] second];

}

+ (NSInteger)getHour
{
    return [[LRXGetTime initTime] hour];

}
+ (NSInteger)getDay
{
    return [[LRXGetTime initTime] day];

}
+ (NSInteger)getMonth
{
    return [[LRXGetTime initTime] month];

}
+ (NSInteger)getYear
{
    return [[LRXGetTime initTime] year];

}
+ (NSString *)getTimeForm
{
    //2016-03-28 11:06:48
    return [NSString stringWithFormat:@"%ld-%02ld-%02ld",[LRXGetTime getYear],[LRXGetTime getMonth],[LRXGetTime getDay]];
}
@end
